<?php
/**
 * Ban the mail from the application
 * It will remove permanently the mail from 
 * the application.
 * If your mailbox is in sync mode, it will move the message to the INBOX directory
 * 
 * @author Xavier VILAIN
 * @package Orx\Mailer
 * @license 
 */
use Orx\Mailer\MailBox\Message\Background\Process;
use Orx\Mailer\MailBox\Message;
$xview = Xview::instance();
$messageids = $xview->val('messageids');
if(!empty($messageids)) {
	// Load All Messages
	$nbNessages = Process::ban(explode(':',$messageids));
	if($nbNessages > 0) {
		Fox\Message::Success(Msg(Orx\Mailer\Messages::BUNDLE,Orx\Mailer\Messages::X_MESSAGES_HAVE_BEEN_BAN_FROM_THE_APPLICATION,$nbNessages));
	} elseif(!Fox\Message::errors()) {
		Fox\Message::Success(Msg(Orx\Mailer\Messages::BUNDLE,Orx\Mailer\Messages::X_MESSAGES_HAVE_BEEN_BAN_FROM_THE_APPLICATION,'0'));
	}
	echo $xview->messages(true,true);
}